Skip to content

[#2571] Added label-driven deployment gate to deploy router.#2575

Merged
AlexSkrypnyk merged 2 commits into
mainfrom
feature/2571-deploy-label-gate
Jun 5, 2026
Merged

[#2571] Added label-driven deployment gate to deploy router.#2575
AlexSkrypnyk merged 2 commits into
mainfrom
feature/2571-deploy-label-gate

Conversation

@AlexSkrypnyk
Copy link
Copy Markdown
Member

@AlexSkrypnyk AlexSkrypnyk commented Jun 5, 2026

Closes #2571

Summary

Added an opt-in label gate to the deploy router: when VORTEX_DEPLOY_ALLOW_LABEL is set to a label name, a pull request is deployed only if it carries that label. Without the label, the deployment is skipped cleanly with an informational note. The gate is inactive by default (empty variable) so existing deployments are unaffected. Branch and tag builds are never gated - only PR builds.

Changes

.vortex/tooling/src/deploy - Added two new variables (VORTEX_DEPLOY_ALLOW_LABEL, VORTEX_DEPLOY_PR_LABELS) and the gate logic: after the skip-list checks, if VORTEX_DEPLOY_ALLOW_LABEL is set and the build is for a PR, the script checks whether the label is present in the comma-separated VORTEX_DEPLOY_PR_LABELS list using an exact-match grep. Deployment is skipped if the label is absent; it proceeds with a confirmation note if present.

.github/workflows/build-test-deploy.yml - Wired VORTEX_DEPLOY_PR_LABELS (populated from github.event.pull_request.labels.*.name via join) and VORTEX_DEPLOY_ALLOW_LABEL (from repository variable vars.VORTEX_DEPLOY_ALLOW_LABEL) into the deploy job environment.

.vortex/installer/tests/Fixtures/ - Updated both baseline and deploy_types_none_gha fixtures to reflect the two new environment variables in the workflow.

.vortex/tooling/tests/unit/deploy.bats - Added 9 new BATS tests covering: gate inactive when variable is unset, PR carries the label (proceeds), PR lacks the label (skipped), non-PR builds unaffected, label among multiple labels, skip-list takes precedence over gate, empty label list, partial-match rejection, and labels containing spaces.

.vortex/docs/ - Added a "Gating deployments on a PR label" section to the deployment README and registered VORTEX_DEPLOY_ALLOW_LABEL in the CI variables reference and the auto-generated variables table.

Before / After

Before (skip-list only):
┌──────────────────────┐
│  Deploy called       │
└──────────┬───────────┘
           │
           ▼
┌──────────────────────┐   yes  ┌─────────────────┐
│ In skip list?        ├───────►│ Skip deployment  │
└──────────┬───────────┘        └─────────────────┘
           │ no
           ▼
┌──────────────────────┐
│ Run deployment       │
└──────────────────────┘

After (skip-list + label gate):
┌──────────────────────┐
│  Deploy called       │
└──────────┬───────────┘
           │
           ▼
┌──────────────────────┐   yes  ┌─────────────────┐
│ In skip list?        ├───────►│ Skip deployment  │
└──────────┬───────────┘        └─────────────────┘
           │ no
           ▼
┌──────────────────────┐   no   ┌─────────────────┐
│ ALLOW_LABEL set AND  ├───────►│ Run deployment   │
│ this is a PR build?  │        └─────────────────┘
└──────────┬───────────┘
           │ yes
           ▼
┌──────────────────────┐   no   ┌─────────────────┐
│ PR carries the label?├───────►│ Skip deployment  │
└──────────┬───────────┘        └─────────────────┘
           │ yes
           ▼
┌──────────────────────┐
│ Run deployment       │
└──────────────────────┘

Summary by CodeRabbit

Release Notes

  • New Features

    • Added opt-in label-based gating for pull request deployments. PRs are now deployed only when they carry a specified authorization label.
    • PR labels are automatically detected and passed to deployment logic.
  • Documentation

    • Added deployment gating configuration guide.
    • Documented new label authorization variable with default values.
  • Tests

    • Added comprehensive unit tests for label-gate behavior, including edge cases and skip-list precedence.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

Linter diff in the way? Review this PR in Change Stack to focus on meaningful changes and expand context only when needed.

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5abf3a16-fbc1-4def-ba09-181ad260b0cb

📥 Commits

Reviewing files that changed from the base of the PR and between fc33c9b and 431294f.

⛔ Files ignored due to path filters (2)
  • .vortex/installer/tests/Fixtures/handler_process/_baseline/.github/workflows/build-test-deploy.yml is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/handler_process/deploy_types_none_gha/.github/workflows/build-test-deploy.yml is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (6)
  • .github/workflows/build-test-deploy.yml
  • .vortex/docs/.utils/variables/extra/ci.variables.sh
  • .vortex/docs/content/deployment/README.mdx
  • .vortex/docs/content/development/variables.mdx
  • .vortex/tooling/src/deploy
  • .vortex/tooling/tests/unit/deploy.bats

Walkthrough

Adds an opt-in PR label gate: when VORTEX_DEPLOY_ALLOW_LABEL is set and VORTEX_DEPLOY_PR is present, the deploy router checks VORTEX_DEPLOY_PR_LABELS for the required label and exits early (skip) if absent. GitHub Actions now exports PR labels and the allow-label variable; docs and unit tests were added.

Changes

PR Label Deployment Gate

Layer / File(s) Summary
Deploy script contract and label gating logic
.vortex/tooling/src/deploy
New environment variables VORTEX_DEPLOY_ALLOW_LABEL and VORTEX_DEPLOY_PR_LABELS are documented, and conditional logic checks whether the required label is present; if not present and gate is enabled for a PR, deployment is skipped early and exits cleanly.
GitHub Actions workflow integration
.github/workflows/build-test-deploy.yml
The deploy step exports VORTEX_DEPLOY_PR_LABELS (comma-separated PR label names from GitHub context) and VORTEX_DEPLOY_ALLOW_LABEL (from GitHub Actions variables) to the deploy router.
Variable definitions and documentation
.vortex/docs/.utils/variables/extra/ci.variables.sh, .vortex/docs/content/development/variables.mdx, .vortex/docs/content/deployment/README.mdx
VORTEX_DEPLOY_ALLOW_LABEL is defined in CI variable documentation and added to the variables reference; deployment docs explain gating semantics, label sourcing from VORTEX_DEPLOY_PR_LABELS, that branch/tag deployments are unaffected, and that skip lists take precedence.
Unit tests for label gate behavior
.vortex/tooling/tests/unit/deploy.bats
Nine new test cases cover: gate inactive when unset, deployment with label present, skipping when label absent, gate not applying to non-PR builds, label matching within multiple labels, skip-list precedence, skipping with empty labels, exact label matching (not substring), and correct matching of labels containing spaces.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A tiny label, a hop and a cheer,
Toggle it on and the env will appear,
Unlabeled PRs rest under the log,
While labeled ones sprint to the testing bog. 🌿✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[#2571] Added label-driven deployment gate to deploy router' directly summarizes the main feature added: a label-driven gate for controlling PR deployments, matching the primary objective.
Linked Issues check ✅ Passed The PR implementation comprehensively addresses all linked issue objectives: implements label-driven gate in deploy router scoped to PRs only, adds VORTEX_DEPLOY_ALLOW_LABEL and VORTEX_DEPLOY_PR_LABELS variables, preserves default behavior when unset, maintains skip-list precedence, provides GitHub Actions wiring, includes tests and documentation.
Out of Scope Changes check ✅ Passed All changes directly support the label-gate feature: deploy router logic, GitHub Actions workflow integration, variable documentation, comprehensive unit tests, and fixture updates are all in-scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/2571-deploy-label-gate

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.11%. Comparing base (f14254e) to head (431294f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2575      +/-   ##
==========================================
- Coverage   86.56%   86.11%   -0.46%     
==========================================
  Files          94       87       -7     
  Lines        4661     4502     -159     
  Branches       47        3      -44     
==========================================
- Hits         4035     3877     -158     
+ Misses        626      625       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the CONFLICT Pull request has a conflict that needs to be resolved before it can be merged label Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/2571-deploy-label-gate branch from fc33c9b to 537a524 Compare June 5, 2026 12:03
@github-actions github-actions Bot removed the CONFLICT Pull request has a conflict that needs to be resolved before it can be merged label Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk changed the title [#2571] Gated environment deployments on a PR label. [#2571] Added label-driven deployment gate to deploy router. Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk added this to the 1.40.0 milestone Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk added the A4 Board worker 4 label Jun 5, 2026
@github-actions

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk

This comment has been minimized.

@github-actions github-actions Bot added the CONFLICT Pull request has a conflict that needs to be resolved before it can be merged label Jun 5, 2026
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/2571-deploy-label-gate branch from 537a524 to 431294f Compare June 5, 2026 22:06
@github-actions github-actions Bot removed the CONFLICT Pull request has a conflict that needs to be resolved before it can be merged label Jun 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (205/208)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk

This comment has been minimized.

2 similar comments
@AlexSkrypnyk

This comment has been minimized.

@AlexSkrypnyk
Copy link
Copy Markdown
Member Author

Code coverage (threshold: 90%)

  Classes: 100.00% (1/1)
  Methods: 100.00% (2/2)
  Lines:   98.56% (205/208)
Per-class coverage
Drupal\ys_demo\Plugin\Block\CounterBlock
  Methods: 100.00% ( 2/ 2)   Lines: 100.00% ( 10/ 10)

@AlexSkrypnyk AlexSkrypnyk merged commit 3beb8fe into main Jun 5, 2026
33 checks passed
@AlexSkrypnyk AlexSkrypnyk deleted the feature/2571-deploy-label-gate branch June 5, 2026 22:30
@github-project-automation github-project-automation Bot moved this from BACKLOG to Release queue in Vortex Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A4 Board worker 4

Projects

Status: Release queue

Development

Successfully merging this pull request may close these issues.

Gate environment deployments on the presence of a PR label

1 participant